package org.easy.socket.server;

import cn.hutool.core.date.DateUtil;
import org.easy.socket.server.enums.ClientStatusEnum;
import org.smartboot.socket.StateMachineEnum;
import org.smartboot.socket.transport.AioSession;

/**
 * @Description:
 * @Author: wxl
 * @CreateTime: 2023/1/10 16:25
 */
public class ClientSession {

    private String clientId;

    private String reqTime;

    private String connectedTime;

    private AioSession session;

    private StateMachineEnum clientStatus;

    public ClientSession (AioSession session, StateMachineEnum clientStatus) {
        this.clientId = session.getSessionID();
        this.reqTime = DateUtil.now();
        this.connectedTime = DateUtil.now();
        this.session = session;
        this.clientStatus = clientStatus;
    }

    public String getClientId() {
        return clientId;
    }

    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    public String getReqTime() {
        return reqTime;
    }

    public void setReqTime(String reqTime) {
        this.reqTime = reqTime;
    }

    public String getConnectedTime() {
        return connectedTime;
    }

    public void setConnectedTime(String connectedTime) {
        this.connectedTime = connectedTime;
    }

    public AioSession getSession() {
        return session;
    }

    public void setSession(AioSession session) {
        this.session = session;
    }

    public StateMachineEnum getClientStatus() {
        return clientStatus;
    }

    public void setClientStatus(StateMachineEnum clientStatus) {
        this.clientStatus = clientStatus;
    }

    @Override
    public String toString() {
        return "ClientSession{" +
                "clientId='" + clientId + '\'' +
                ", reqTime='" + reqTime + '\'' +
                ", connectedTime='" + connectedTime + '\'' +
                ", session=" + session +
                ", clientStatus=" + clientStatus +
                '}';
    }
}
